/*
 * Copyright (c) 2009 Nathaniel Houghton <nathan@brainwerk.org>
 *                    Robert Kirchgessner <rkirchge@gmail.com>
 *
 * Permission to use, copy, modify, and distribute this software for
 * any purpose with or without fee is hereby granted, provided that
 * the above copyright notice and this permission notice appear in all
 * copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA
 * OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 * PERFORMANCE OF THIS SOFTWARE.
 *
 */
 
#ifndef ELM_DTC_H
#define ELM_DTC_H

#include <stdint.h>

#define CHECK_ENGINE_MSK 	0x80
#define DTC_COUNT_MSK 		0x7F

/*elm_dtc_peek returns 1 byte. The MSB is the check engine flag. The least sig. 7 bits are the # dtc.*/
void 		elm_dtc_update(); /*Updates the DTC linked list*/

uint8_t 	elm_dtc_count(); /*Gets the number of trouble codes detected*/
uint8_t		elm_dtc_mil(); /*Gets whether the check engine light is on */

uint16_t	elm_dtc_current(); /*Get the current dtc*/
uint16_t	elm_dtc_next(); /*Get the next dtc*/
uint16_t	elm_dtc_prev(); /*Get previous dtc*/

void	  	elm_dtc_clear(); /*Clear the trouble codes*/

 #endif
